package com.meilai.project.controller.web.business.workbench;

import com.meilai.project.dto.CommonResult;
import com.meilai.project.dto.business.workbench.UserYearWeekTargetDTO;
import com.meilai.project.service.business.workbench.SaleWeekTargetService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 销售每周目标表 前端控制器
 * </p>
 *
 * @author haiYangXu
 * @since 2022-08-16
 */
@RestController
@RequestMapping("/api/web/saleWeekTarget")
public class SaleWeekTargetController {
    @Autowired
    private SaleWeekTargetService service;

    @ApiOperation("添加周目标")
    @PostMapping("/add")
    public CommonResult add(@RequestBody UserYearWeekTargetDTO dto) {
        return new CommonResult().success(service.add(dto));
    }

    @ApiOperation("获取周列表数据")
    @GetMapping("/queryWeekList")
    public CommonResult queryWeekList(@RequestParam("year") Integer year, @RequestParam("type") Integer type) {
        return new CommonResult().success(service.queryWeekList(year, type));
    }
}
